package preprocessor.absorption.extended;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

import kb.DescriptionLogicsKB;
import kb.TBox;
import utils.exception.CoreReasoningException;
import utils.io.KBAccess;

public class TestConversion {

	/**
	 * @param args
	 * @throws CoreReasoningException 
	 */
	public static void main(String[] args) throws CoreReasoningException {
		DescriptionLogicsKB kb = null;
		String fileloc = "testkb.kb";
		try {
			FileReader fr = new FileReader(fileloc);
			BufferedReader br = new BufferedReader(fr);
			kb = KBAccess.processKBFile(
					br,
					false,
					fileloc.substring(fileloc.lastIndexOf('/') + 1,
							fileloc.lastIndexOf('.')));
			System.err.printf("\nKB: %s,Axioms:%d, CAs:%d, RAs:%d, Inds:%d \n",
					kb.getKBName(), kb.getKBStat().getNumAx(), kb.getKBStat()
							.getNumCA(), kb.getKBStat().getNumRA(), kb
							.getKBStat().getTotalInstances());
		} catch (Exception e) {
			e.printStackTrace();
		}
		// start conversion
		TBox newtb = AssertionConversion.convert(kb.getTbox(), kb.getAbox());
		newtb.compileTBox();
		System.out.println(newtb.toString());
	}

}
